function downloadImage(url) {
    const link = document.createElement('a');
    link.href = url;
    link.download = 'image.jpg'; // 设置下载的文件名
    document.body.appendChild(link);
    link.click();
    document.body.removeChild(link);
}

// 休眠函数
function sleep(milliseconds) {
    var start = new Date().getTime();
    while (new Date().getTime() < start + milliseconds) {}
}


function downloadImages(images) {
    // 将字符串按英文逗号分割成数组
    var imageUrls = images.split(',');

    // 遍历数组，调用downloadImage()方法进行下载
    for (var i = 0; i < imageUrls.length; i++) {
        downloadImage(imageUrls[i]);
        // 休眠10毫秒
        sleep(500);
    }
}

// 示例用法
var images = "https://example.com/image1.jpg,https://example.com/image2.jpg,https://example.com/image3.jpg";
downloadImages(images);